@file:OptIn(ExperimentalUuidApi::class)

package com.harth.blemultiplatform.ble

import kotlin.uuid.ExperimentalUuidApi
import kotlin.uuid.Uuid

interface IDescriptor{
    val uuid: Uuid
    val characteristic: ICharacteristic
    val service: IService
        get() = characteristic.service
    val peripheral: IPeripheral
        get() = service.peripheral
    suspend fun read(): ByteArray

    /**
     * Writes the value of the characteristic.
     *
     * @param data The data to be written.
     * @param writeType The write type to be used.
     * @throws OperationFailedException if the operation failed.
     * @throws InvalidAttributeException if the characteristic has been invalidated due to
     * disconnection of service change event.
     * @throws BluetoothException if the implementation fails, see cause for a reason.
     */
    suspend fun write(data: ByteArray)
}